package apk.yoursms.ad;

import android.widget.LinearLayout;
import apk.yoursms.settings.Statistics;

import com.google.ads.Ad;
import com.google.ads.AdListener;
import com.google.ads.AdRequest.ErrorCode;
import com.google.ads.AdView;

/**
 * implements AdListener admob
 * 
 */
public class AdmobListener implements AdListener {

    private final LinearLayout mLLAdmob;
    private final AdView mAdView;

    public AdmobListener(final LinearLayout LLAdmob, final AdView adview) {
	mLLAdmob = LLAdmob;
	mAdView = adview;
    }

    @Override
    public void onDismissScreen(Ad arg0) {
    }

    @Override
    public void onFailedToReceiveAd(Ad arg0, ErrorCode arg1) {
    }

    @Override
    public void onLeaveApplication(Ad arg0) {
	Statistics.setData("YourSms - ads click");
	mLLAdmob.removeView(mAdView);
    }

    @Override
    public void onPresentScreen(Ad arg0) {
    }

    @Override
    public void onReceiveAd(Ad arg0) {
	// Created animation for ClickAdView
//	AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f);
//	animation.setDuration(30);
//	animation.setFillAfter(true);
//	animation.setInterpolator(new AccelerateInterpolator());
//	mAdView.startAnimation(animation);
    }

}